package com.ruoyi.business.controller;

import com.ruoyi.business.service.SmsService;
import com.ruoyi.business.vo.SmsReqVo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 【短信功能】Controller
 *
 * @author Tellsea
 * @date 2024-12-23
 */
@Api(tags = "【短信功能】Controller")
@RestController
@RequestMapping("/business/sms")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class SmsController extends BaseController {

    private final SmsService smsService;

    @ApiOperation("修改短信开关")
    @PostMapping("/update")
    public AjaxResult updateSmsClose(@RequestBody @Validated SmsReqVo smsReqVo) {
        smsService.setSmsClose(smsReqVo.getSmsClose());
        return AjaxResult.success("修改成功");
    }

    @ApiOperation("获取短信开关信息")
    @GetMapping("/getInfo")
    public AjaxResult getInfo() {
        return AjaxResult.success("获取成功",smsService.getSmsClose());
    }


}
